import './App.css';
import { createStore } from 'redux';
import Counter from './components/Counter';
import { Provider } from 'react-redux';

const initialState = {
  count: 0
}

function reducer (state = initialState, action) {
  switch (action.type) {
    case 'increment' :
      return {
        count: state.count + 1
      }
    case 'decrement':
      return {
        count: state.count - 1
      }
    default: 
      return state
  }
}
const store = createStore(reducer)

// const increment = { type: 'increment'};
// const decrement = { type: 'decrement'};

function App() {
  return (
    <Provider store={store}>
      <div className="App">
       <Counter />
      </div>
    </Provider>
  );
}

export default App;
